# -*- coding: utf-8 -*-

from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication
import sys

from login import LoginWindow
from main import MainWindow

if __name__ == "__main__":
    try:
        QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
        app = QApplication(sys.argv)
        app.setOrganizationName("Qtrac Ltd.")
        app.setOrganizationDomain("qtrac.eu")
        app.setApplicationName("恒通房管")
        # app.setWindowIcon(QIcon(":/logo.ico"))
        loginwindow = LoginWindow()
        loginwindow.show()
        #mainwindow = MainWindow()
        #mainwindow.show()
        exit_code = app.exec_()
        print("exit_code：" + str(exit_code))
        if exit_code == 888:
            print("restart")
            loginwindow = LoginWindow()
            loginwindow.show()
            sys.exit(app.exec_())
        else:
            sys.exit()
    except Exception as err:
        print("Main Unexpected error:", sys.exc_info())  # sys.exc_info()返回出错信息
